﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WF.Model;

namespace WF.ViewModels.WorkflowInfo
{
    public class ShowStatusChartVM : ViewModelBase
    {
        public int GetProcInstIDByBizDataID(string bizDataID)
        {
            BusinessObject.WF_ApplyInstance bo = new BusinessObject.WF_ApplyInstance();
            WF_ApplyInstanceEntity entity = bo.GetByBizDataID(bizDataID);

            return (entity.ProcInstID == null) ? 0 : int.Parse(entity.ProcInstID.ToString());
        }

        public WF_ApplyInstanceEntity GetApplyInstanceEntityByProcInstID(int p)
        {
            BusinessObject.WF_ApplyInstance bo = new BusinessObject.WF_ApplyInstance();
            return bo.GetByProcInstID(p);
        }

        public List<WF_ApplyInstanceStateDetailEntity> GetApplyInstanceStateDetailByProcInstID(int procInstID)
        {
            BusinessObject.WF_ApplyInstanceStateDetail bo = new BusinessObject.WF_ApplyInstanceStateDetail();
            return bo.GetApplyInstanceStateDetailByProcInstID(procInstID);
        }

        public string GetFolioByProcInstID(int p)
        {
            WF_ApplyInstanceEntity entity = this.GetApplyInstanceEntityByProcInstID(p);
            if (entity.Folio != null)
            {
                return entity.Folio;
            }
            else
            {
                return "";
            }
        }
    }
}
